package com.huiruan.controller;

import cn.hutool.db.PageResult;
import com.huiruan.dto.CommentDTO;
import com.huiruan.utils.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author CTL
 * @create 2025-05-14 8:17
 */
@RestController
@RequiredArgsConstructor
public class CommentController {

    /**
     * 获取商品评论列表
     * @param productId
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/comment")
    public Result getCommentList(
            @PathVariable Long productId,
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer size) {
        return Result.success();
    }

    /**
     * 新增评论
     * @param commentDTO
     * @return
     */
    @PostMapping("/add")
    public Result<Void> addComment(@RequestBody CommentDTO commentDTO) {
//        Long userId = SecurityUtils.getCurrentUserId();
//        commentService.addComment(userId, commentDTO);
        return Result.success();
    }

    /**
     * 删除评论
     * @param id
     * @return
     */
    @DeleteMapping("/delete/{id}")
    public Result<Void> deleteComment(@PathVariable Long id) {
//        Long userId = SecurityUtils.getCurrentUserId();
//        commentService.deleteComment(userId, id);
        return Result.success();
    }

    /**
     * 点赞评论
     * @param id
     * @return
     */
    @PostMapping("/like/{id}")
    public Result<Void> likeComment(@PathVariable Long id) {
//        Long userId = SecurityUtils.getCurrentUserId();
//        commentService.likeComment(userId, id);
        return Result.success();
    }
}
